package com.icart.repositories;


import com.icart.entities.FiIncomefeeEntity;
import com.icart.entities.WoInfopayEntity;
import org.springframework.context.annotation.Scope;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
@Scope("prototype")
public interface FiIncomefeeRepository extends BaseRepository<FiIncomefeeEntity,Integer> {
    @Transactional
    @Query(nativeQuery = true,value = "insert into fi_incomefee (incomeid, sourceid, tradekind, tradeobj, tradeobjname,tradedate, planfee, realfee, realexefee, feestatus, makefeeman, getfeeman, lastgetfeetime, checkstatus,chnid, makefee, creditfee) " +
            "select ?1,?2,'receivable',?3,(select custname from cu_custinfo where custid=?4)as tradeobjname,?5,saleprice,saleprice,saleprice,1,0,0,?6,0,creatchn,saleprice,0 from mk_discpack where tcid=?7")
    @Modifying(clearAutomatically = true)
    Integer savefi(String incomeid,String oid,Long custid,Long custid2,String time,String time2,Long tcid);
}
